#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
using namespace std;

/*class Base {
protected:
    int x;
    int y;
public:
    Base(int xx = 0, int yy = 0)
    {
        x = xx;
        y = yy;
        cout << "Base(" << x << "," << y << ")" << endl;
    }
    void show()
    {
        cout << "Base: x=" << x << ",y=" << y  << endl;
    }
};

class Derive :public Base {
public:
    Derive(int xx,int yy):Base(xx,yy)
    {
        cout << "Derive(" << x << "," << y << ")" << endl;
    }
    void show()
    {
        cout << "Derive: x=" << x << ",y=" << y << endl;
    }
};

class Base {
private:
    int x;
public:
    void setx(int n)
    {
        x = n;
    }
    void showx()
    {
        cout << x << endl;
    }
};

class Derived : private Base {
private:
    int y;
public:
    void setxy(int n, int m)
    {
        setx(n);
        y = m;
    }
    void showxy()
    {
        showx();
        cout << y << endl;
    }
};

class Base {
protected:
    int a;
public:
    void seta(int sa)
    {
        a = sa;
    }
    void showa()
    {
        cout << "a=" << a << endl;
    }
};
class Derive1 :private Base {
protected:
    int b;
public:
    void setab(int sa, int sb)
    {
        seta(sa);
        b = sb;
    }
    void showab()
    {
        showa();
        cout << "b=" << b << endl;
    }
};
class Derive2 :private Derive1 {
private:
    int c;
public:
    void setabc(int sa, int sb, int sc)
    {
        setab(sa, sb);
        c = sc;
    }
    void showabc()
    {
        showab();
        cout << "c=" << c << endl;
    }
};

class Base {
private:
    int x;
protected:
    int y;
public:
    void setxy(int m, int n)
    {
        x = m;
        y = n;
    }
    void showxy()
    {
        cout << "x=" << x << endl;
        cout << "y=" << y << endl;
    }
};

class Derived :public Base {
private:
    int z;
public:
    void setxyz(int m,int n,int l)
    {
        setxy(m, n);
        z = l;
    }
    void showxyz()
    {
        showxy();
        cout << "z=" << z << endl;
    }
};

class Base {
public:
    int z;
    void setx(int i)
    {
        x = i;
    }
    int getx()
    {
        return x;
    }
private:
    int x;
protected:
    int y;

};

class Derived :protected Base {
private:
    int m;
protected:
    int n;
public:
    int p;
    void setall(int a, int b, int c, int d, int e, int f)
    {
        setx(a);
        y = b;
        z = c;
        m = d;
        n = e;
        p = f;
    }
    void show()
    {
        cout << "x=" << getx() << endl;
        cout << "y=" << y << endl;
        cout << "z=" << z << endl;
        cout << "m=" << m << endl;
        cout << "n=" << n << endl;
    }
};

class Base {
    public:
        Base()
        {
            cout << "Constructing base class\n";
        }
        ~Base()
        {
            cout << "Destructing base class\n";
        }
};

class Derived : public Base {
public:
    Derived()
    {
        cout << "Constructing derived class\n";
    }
    ~Derived()
    {
        cout << "Destructing derived class\n";
    }
};
int main()
{
    Derived obj;
    return 0;
}

class Student {
protected:
    int number;
    string name;
    float score;
public:
    Student(int number1, string name1, float score1)
    {
        number = number1;
        name = name1;
        score = score1;
    }
    void print()
    {
        cout << "number:" << number << endl;
        cout << "name:" << name << endl;
        cout << "score:" << score << endl;
    }
};

class UStudent :public Student {
private:
    string major;
public:
    UStudent(int number1, string name1, float score1, string major1) :Student(number1, name1, score1)
    {
        major = major1;
    }
    void print1()
    {
        print();
        cout << "major:" << major << endl;
    }
};

int main()
{
    int num;
    string name;
    int score;
    string major;
    cin >> num >> name >> score >> major;
    UStudent stu(num, name, score, major);
    stu.print1();

    return 0;
}

class A {
public:
    A()
    {
        cout << "Constructing class A.\n";
    }
    ~A()
    {
        cout << "Destructing class A.\n";
    }
};
class B :public A {
public:
    B()
    {
        cout << "Constructing class B.\n";
    }
    ~B()
    {
        cout << "Destructing class B.\n";
    }
};

int main()
{
    B b;
    return 0;
}*/

class Base {
private:
    int x;
public:
    Base(int i)
    {
        x = i;
        cout << "Constructing class Base.\n";
    }
    ~Base()
    {
        cout << "Destructing class Base.\n";
    }
    void show()
    {
        cout << "x=" << x << endl;
    }
};

class Derived :public Base {
public:
    Derived(int i) :Base(i), d(i)
    {
        cout << "Constructing derived class.\n";
    }
    ~Derived()
    {
        cout << "Destructing derived class.\n";
    }
private:
    Base d;
};

int main()
{
    Derived obj(5);
    obj.show();
    return 0;
}